package com.xywl.escort.view.bandcard

import android.os.Bundle
import com.alibaba.android.arouter.facade.annotation.Autowired
import com.alibaba.android.arouter.facade.annotation.Route
import com.alibaba.android.arouter.launcher.ARouter
import com.xywl.escort.R
import com.xywl.escort.base.BaseActivity
import com.xywl.escort.bean.BandCardListResp
import com.xywl.escort.widget.GlideApp
import kotlinx.android.synthetic.main.activity_band_card_detail.*
import timber.log.Timber

@Route(path = "/xy/band/card/detail")
class BandCardDetailActivity : BaseActivity() {
    @Autowired
    @JvmField
    var bandBean: BandCardListResp.DataBean.ListBean? = null

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_band_card_detail)
        ARouter.getInstance().inject(this)

        Timber.e("bandBean=$bandBean")

        GlideApp.with(this)
                .load(bandBean!!.mobileBankIco)
                .centerCrop()
                .placeholder(R.mipmap.icon_default_picture)
                .into(image_band)

        layout_band_card.setBackgroundResource(R.mipmap.image_card_type_1)
        val bandName = bandBean!!.bankName  + "(借记卡)"
        text_band_name.text = bandName

        val bandCardNo = "**** **** **** "
        var bankCardNo = bandBean!!.bankCardNo
        if (bandBean!!.bankCardNo.length > 4) {
            bankCardNo = bandCardNo + bankCardNo.substring(bankCardNo.length - 4, bankCardNo.length)
        } else {
            bankCardNo = bandCardNo + bankCardNo
        }
        text_band_card_no.text = bankCardNo

        val singleQuota = "￥" + bandBean!!.singleLimit
        text_single_quota.text = singleQuota

        val dailyQuota = "￥" + bandBean!!.dailyLimit
        text_daily_quota.text = dailyQuota

    }
}
